<%@ page language="java" %>
<%@ page import="java.util.ArrayList,
                 com.scalar.chiptrack.operations.process.VendorLocation,
                 com.scalar.chiptrack.operations.vendor.dao.VendorDAO,
                 com.scalar.chiptrack.utils.ConfigManager"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/assembly.do"/>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<html:html locale="true">
<HEAD>
<TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/assembly_process.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script language='javascript'>
    function back(){
       window.location = '<%=chipTracContext%>/processView.do?action=true&productID='+document.assemblyForm.baseProductId.value;
    }

</script>
</HEAD>

<BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0" onLoad="javascript:whileLoad()">
<%
  java.util.ArrayList list = new java.util.ArrayList();
  list.add(new org.apache.struts.util.LabelValueBean("As Needed", "asneeded"));
  list.add(new org.apache.struts.util.LabelValueBean("Weekly", "weekly"));
  list.add(new org.apache.struts.util.LabelValueBean("Monthly", "monthly"));
  list.add(new org.apache.struts.util.LabelValueBean("Quarterly", "quarterly"));
  pageContext.setAttribute("poFrequencies", list);
%>
<!-- Top Header Start-->
<%@include file="/jsp/includes/header.jsp"  %>
<!-- Top Header End-->

<html:form name="assemblyForm" type="com.scalar.chiptrack.operations.assembly.forms.AssemblyForm" action="/assembly?action=save" enctype="multipart/form-data">
<html:hidden name="assemblyForm" property="baseProductId"/>
<html:hidden name="assemblyForm" property="processStepId"/>
<html:hidden name="assemblyForm" property="previousStepId"/>
<html:hidden name="assemblyForm" property="stepName"/>
<html:hidden name="assemblyForm" property="trackId"/>

<TABLE cellSpacing='0' cellPadding='0' width='100%' border='0'>
	<TBODY>
	<TR>
		<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
		<!-- Side Navigation start -->
		<%@include file="/jsp/operations/operations_menu.jsp" %>
		</TD>
		<!-- end of the side navigations -->
		<TD bgcolor="#ffffff">
			<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8>
		</TD>
		<TD bgcolor="#ffffff">
			<IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2>
		</TD>
		<TD valign="top" width="100%">
			<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
			<BR>
			<!-- from here your body starts -->
			<center><span class="NArialW">Assembly</span></center>
			<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>
			<p align="left"><chiptrack:errors styleClass="NArialL"/></p>

			<p align="left">
		
			<strong><font class="NArialL"><font color="FF0000"><font id="message"></font></font></font></strong>
	
			</p>
  		    <table border='0' width='90%'  align='center'>
  			<tr>
    			<td width="21%"><font class="NArialL">Assembly Product Name:</font></td>
    			<td width="28%" align="left"><font class="NArialL">
					<html:text name="assemblyForm" property="productName" size="17" maxlength="50" styleClass="txfield"/></font><a href="javascript:addDupPartNumber('dupProductName','Assembly Product Name');" title='Click here to add duplicate Product Name'><img border=0 src='<%=chipTracContext%>/jsp/includes/images/add.jpg' height='15' width='20' align=center></a>
                    <!-- added by hareesh on 26th August 2003 -->
                    <html:hidden name="assemblyForm" property="oldProductName" />
				</td>
          		<td width="5%">&nbsp;</td>
    			<td width="18%"><font class="NArialL">Package ID:</font></td>
    			<td width="37%" align="left">
         			<html:text name="assemblyForm"  property="packageID" size="17" maxlength="50" styleClass="txfield"/>
     			</td>
   			</tr>
			<logic:iterate name="assemblyForm" property="dupProductName" id="xxxx">
				<tr>
			 		<td width="21%"><font class="NArialL"><font color=green>Assembly Product Name:</font></font></td>
					<td width="28%" align="left">
						<input type="text" name="dupProductName" value="<%=xxxx%>" class=txfield size="17" maxlength="50" />
					</td>
				</tr>
		    </logic:iterate>
		    <tr>
				<td colspan='5'><font id="font1"></font></td>
		    </tr>
			<tr>
    			<td width="21%"><font class="NArialL">Standard Unit Cost:</font></td>
    			<td width="28%" align="left">
        			<html:text name="assemblyForm"  property="standardUnitCost" size="17" maxlength="50" styleClass="txfield"/>
    			</td>
    			<td width="5%">&nbsp;</td>
                <td width="18%"><font class="NArialL">Target Yield:</font></td>
    			<td width="37%" align="left">
					<html:text name="assemblyForm"  property="targetYield" size="17" maxlength="50" styleClass="txfield"/>
				</td>
  			</tr>
  			<tr>
    			<td width="21%"><font class="NArialL">Lot Scrap Yield Limit:</font></td>
    			<td width="28%" align="left">
					<html:text name="assemblyForm"  property="lotScrapYieldLimit" size="17" maxlength="50" styleClass="txfield"/>
				</td>
    			<td width="5%">&nbsp;</td>
    			<td width="18%"><font class="NArialL">PO Frequency:</font></td>
    			<td width="37%" align="left"><font class="NArialL">
                    <html:select name="assemblyForm" property="poFrequency" styleClass="txfield">
						<html:option value="0">Select</html:option>
                        <html:options collection="poFrequencies" property="value" labelProperty="label"/>
                    </html:select>
        		</font></td>
  			</tr>
  			<tr>
    			<td width="21%"><font class="NArialL">Procedure Doc. Number:</font></td>
    			<td width="28%" align="left"><font class="NArialL">
    				<html:text name="assemblyForm"  property="procedureDocNumber" size="17" maxlength="50" styleClass="txfield"/>
				</font></td>
    			<td width="5%">&nbsp;</td>
    			<td width="18%"><font class="NArialL">Procedure Doc File:</font></td>
    			<td width="37%" align="left"><html:file property="procedureDocFile" size="9" styleClass="txfield" /></td>
  			</tr>
  			<tr>
   				<td width="21%" ><font class="NArialL">Marking Spec:</font></td>
   				<td width="28%" align="left"><font class="NArialL">
   					<html:text name="assemblyForm"  property="markingSpec" size="17" maxlength="50" styleClass="txfield"/>
				</font></td>
   				<td width="5%">&nbsp;</td>
   				<td width="18%"><font class="NArialL">Bonding Diagram Doc. Number:</font></td>
    			<td width="37%" align="left"><font class="NArialL">
    				<html:text name="assemblyForm"  property="bondingDiagramDocNumber" size="17" maxlength="50" styleClass="txfield"/>
				</font></td>
  			</tr>
  			<tr>
    			<td width="21%"><font class="NArialL">Marking Spec File:</font></td>
    			<td width="28%" align="left"><html:file property="markingSpecFile" size="9" styleClass="txfield" /></td>
   				<td width="5%">&nbsp;</td>
    			<td width="18%"><font class="NArialL">Bonding Diagram Doc File:</font></td>
    			<td width="37%" align="left"><html:file property="bondingDiagramDocFile" size="9" styleClass="txfield" /></td>
  			</tr>
  			<tr>
    			<td width="21%"><font class="NArialL">&nbsp;</font></td>
    			<td width="28%" align="center"><font class="NArialL">&nbsp;</font></td>
    			<td width="5%"><font class="NArialL">&nbsp;</font></td>
    			<td width="18%"><font class="NArialL">&nbsp;</font></td>
    			<td width="37%" align="left"><font class="NArialL">&nbsp;</font></td>
  			</tr>
  			<tr>
    			<td width="1000%" colspan=6 align="left"><font class="NArialL">
					<html:checkbox name="assemblyForm"  property="dateCodeMarked" styleClass="txfield"/>&nbsp;Date Code Marked:
				</font></td>
  			</tr>
  			<tr><td colspan=6><img height=10 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td></tr>
  			<tr>
    			<td width="100%" colspan=6 class="NArialL" align="left">Comments:<br>
    				<html:textarea name="assemblyForm"  rows="5" property="comments" cols="83" styleClass="txfield"/>
				</td>
  			</tr>
  			<tr><td colspan=6><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
  			<tr>
				<td colspan=6 width="100%">
    				<table width="98%" border=0 bordercolor="#FFFFFF" height="62">
					<tr>
						<td class="NArialL" colspan=9 width="477" height="18">Vendor Location Information:</td>
					</tr>
					<tr>
		   				<td width="45" align="center" bgcolor="#993333" height="1"><font class="NArialL"><font color="#FFFFFF">Select</font></td>
		   				<td width="53" align="center" bgcolor="#993333" height="1"><font class="NArialL"><font color="#FFFFFF">Priority</font></td>
		   				<td width="62" align="center" bgcolor="#993333" height="1"><font class="NArialL"><font color="#FFFFFF">Location</font></font></td>
		   				<td width="32" align="center" bgcolor="#993333" height="1"><font class="NArialL"><font color="#FFFFFF">% Split</font></td>
		   				<td width="64" bgcolor="#993333" height="1" ><font class="NArialL"><font color="#FFFFFF">Capacity/Week</font></font></td>
		   				<td width="148" align="center" bgcolor="#993333" colspan="2" >
          				<p align="center">
                            <font color="#FFFFFF" class="NArialL">&nbsp;&nbsp;&nbsp;&nbsp;</font>
                            <font class="NArialL"><font color="#FFFFFF">Cost/Unit&nbsp;&nbsp;</font></font>
                            <font class="NArialL">&nbsp;&nbsp;&nbsp;&nbsp;</font>
                            <font color="#FFFFFF" class="NArialL"><font color="#FFFFFF">Normal&nbsp; Express</font></font>
                        </p>
         				</td>
		  				<td width="148" align="center" bgcolor="#993333" colspan="2" >
          				<p align="center">
							<font color="#FFFFFF" class="NArialL">&nbsp;&nbsp;&nbsp;</font>
        					<font class="NArialL"><font color="#FFFFFF">Cycle Time</font></font>
							<font class="NArialL">&nbsp;&nbsp;&nbsp;</font>
        					<font color="#FFFFFF" class="NArialL"><font color="#FFFFFF">Normal&nbsp; Express</font></font>
        				</p>
            			</td>
		   				<td width="95" align="center" bgcolor="#993333">
						    <font class="NArialL"><font color="#FFFFFF">Expected Yield</font></font>
						</td>
		   				<td width="61" align="center" bgcolor="#993333">
							<font class="NArialL"><font color="#FFFFFF">&nbsp;Raw Material Source</font></font>
						</td>
		   				<td width="51" align="center" bgcolor="#993333" colspan="2">
            				<font class="NArialL"><font color="#FFFFFF" > Raw Material Level</font>
            			    <br> <font class="NArialL"><font color="#FFFFFF">&nbsp;Min&nbsp;&nbsp;&nbsp;&nbsp;Max</font></p>
            				</font>
            				</font>
           				</td>
		 				</tr>
                        <%
                            ArrayList vendorLocations = (ArrayList) request.getAttribute("vendorLocations");
                            if (vendorLocations == null) vendorLocations = new ArrayList();
                            int size = vendorLocations.size();
                            VendorLocation location = null;
                            for (int i=0; i<size; i++) {
                                location = (VendorLocation) vendorLocations.get(i);
                        %>
                        <tr>
                            <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type="checkbox" name="<%="select_"+i%>" <%if((location.getSelect() != null) && (location.getSelect().trim().length() != 0)) out.print ("checked");%>  class="txfield" onclick="checkLocation(<%=i%>,'select_')" value="off"/></font></td>
                            <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="priority" size="6" disabled="true" value='<%if (location.getPriority() != null) out.print (location.getPriority());%>' class="txfield" /></font></td>
                            <td width="20%" align="center"  bgcolor="#DEE1E2">  <font class="NArialL">
                            <input type="text" name="locationName" value='<%=location.getLocationName()%>' disabled="true" size="18" class="txfield" />
                            <input type="hidden" name="locationID" value='<%=location.getLocationID()%>' size="18" class="txfield" /></font></td>
                            <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="split" size="7" disabled="true" value='<%if (location.getSplit() != null) out.print (location.getSplit());%>' class="txfield" /></font></td>
                            <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="capacityWeek" size="14" disabled="true" value='<%if (location.getCapacityWeek() != null) out.print (location.getCapacityWeek());%>' class="txfield" /></font></td>
                            <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="normalCost" size="6" disabled="true" value='<%=location.getNormalCost()%>' class="txfield" /></font></td>
                            <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="expressCost" size="6" disabled="true" value='<%=location.getExpressCost()%>' class="txfield" /></font></td>
                            <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="normalCycleTime" size="6" disabled="true" value='<%if (location.getNormalCycleTime() != null) out.print (location.getNormalCycleTime());%>' class="txfield" /></font></td>
                            <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="expressCycleTime" size="6" disabled="true" value='<%if (location.getExpressCycleTime() != null) out.print (location.getExpressCycleTime());%>' class="txfield" /></font></td>
                            <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="expectedYield" size="6" disabled="true" value='<%=location.getExpectedYield()%>' class="txfield" /></font></td>
                            <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=checkbox name="<%="rawMaterialSource_"+i%>" onclick="checkRaw(<%=i%>,'rawMaterialSource_')" size="6" disabled="true" <%if(location.getRawMaterialSource() == true) out.print ("checked");%> class="txfield" /></font></td>
                            <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="rawLevelMin" size="6" disabled="true" value='<%if (location.getRawLevelMin() != null) out.print (location.getRawLevelMin());%>' class="txfield" /></font></td>
                            <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="rawLevelMax" size="6" disabled="true" value='<%if (location.getRawLevelMax() != null) out.print (location.getRawLevelMax());%>' class="txfield" /></font></td>
                        </tr>
                        <%
                            }
                        %>
    					</table>
						<input type="hidden" name="count" value="<%=size%>" >
  				</td>
				</tr>
  				<tr><td colspan=6><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                <tr>
                <td align=center colspan=6 height="27">
                    <!--a href="<%=chipTracContext%>/jsp/operations/die_bank.jsp"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/back.gif" width="39" height="17"></a-->
                    <chiptrack:restrictedLink functionality='<%=Functionality.PRODUCT_SETUP%>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:back();' onmouseover="window.status='Click here to go back to Process View';return true" onmouseout="window.status='';return true">
                    <img border='0' src='<%=chipTracContext%>/jsp/includes/images/back.gif'></chiptrack:restrictedLink></a>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <!--a href="javascript:saveAssemblyData()"><image border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif"-->
                    <chiptrack:restrictedLink functionality='<%=Functionality.PRODUCT_SETUP%>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:saveAssemblyData();' onmouseover="window.status='Click here to save this Assembly Process';return true" onmouseout="window.status='';return true">
                    <img border='0' src='<%=chipTracContext%>/jsp/includes/images/next.gif'></chiptrack:restrictedLink>
                </td>
                </tr>
			</table>
<!-- till here -->
			<BR><BR><BR>
			</TD>
			<TD bgcolor="#ffffff">
				<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1>
			</TD>
		</TR>
	</TABLE>
</html:form>
<!-- Footer starts here -->
	<%@include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</body>
</html:html>